﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using LastoRevival.Website.Engine;
using AttributeRouting.Web.Mvc;

namespace LastoRevival.Website.Controllers
{
    public class MobileController : LastoControllerBase
    {
		[GET("mobile/landing")]
		public ViewResult Landing()
		{
			return View("MobileLanding");
		}

		private ActionResult GetRedirect(string returnUrl)
		{
			if (string.IsNullOrEmpty(returnUrl))
			{
				return RedirectToAction("index", "forum");
			}

			return Redirect(returnUrl);
		}

		[GET("mobile/enable")]
		public ActionResult MobileAlways(string returnUrl)
		{
			OverridableViewEngine.SetLayout(HttpContext, true, true);

			return GetRedirect(returnUrl);
		}

		[GET("mobile/enable/once")]
		public ActionResult MobileOnce(string returnUrl)
		{
			OverridableViewEngine.SetLayout(HttpContext, true, false);

			return GetRedirect(returnUrl);
		}

		[GET("mobile/disable")]
		public ActionResult StandardAlways(string returnUrl)
		{
			OverridableViewEngine.SetLayout(HttpContext, false, true);

			return GetRedirect(returnUrl);
		}

		[GET("mobile/disable/once")]
		public ActionResult StandardOnce(string returnUrl)
		{
			OverridableViewEngine.SetLayout(HttpContext, false, false);

			return GetRedirect(returnUrl);
		}

    }
}
